﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;

namespace KillBill.Presentarion.Common.Printing.Reports
{
    public class ReportPrinter
    {
        private Queue<object[]> _data;
        #region Properties
        #region Static
        public static string CompanyName { get; set; }
        public static List<string> CompanyData { get; set; }
        #endregion
        public Image Grafic { get; set; }
        public int GraficHeight { get; set; }
        public List<ColumnConfiguration> ColumnFormat { get; set; }
        public object[,] Data { get; set; }
        #endregion

        private void ReportPrintPage(object sender, PrintPageEventArgs ev)
        {

        }

    }
    public class TextFormater
    {
        #region STRING STANDAR
        public static string GetStandardInteger(int value, int length)
        {
            string output = value.ToString();
            output = (output.Length < length) ? (new string('0', length - output.Length) + output) : output;
            return output;
        }
        public static string GetStandarDate(DateTime date)
        {
            return date.ToShortDateString();
        }
        public static string GetHour(DateTime date)
        {
            return date.ToLongTimeString();
        }
        public static string StandardizeNumber(double value, int presition, int fieldLength)
        {
            string intSection = "";
            string decSection = "";
            string[] values = (value + "").Trim().Replace('.', ',').Split(",".ToCharArray());
            intSection = values[0];
            if (values.Length == 1)
                while (decSection.Length < presition)
                    decSection += "0";
            else if (values.Length == 2)
            {
                decSection = values[1];
                if (decSection.Length > presition)
                    decSection = decSection.Substring(0, presition);
                else if (decSection.Length < presition)
                    while (decSection.Length < presition)
                        decSection += "0";
            }
            return StandardizeString(intSection + "," + decSection, TextAlignment.Right, fieldLength);
        }
        public static string StandardUnderlineString(int length)
        {
            string output = "";
            while (output.Length < length)
                output += "_";
            return output;
        }
        public static string Spc(int length)
        {
            string output = "";
            while (output.Length < length)
                output += " ";
            return output;
        }
        public static string StandardizeString(string inputString, TextAlignment alignment, int length)
        {
            string outputString = inputString;
            if (outputString.Length > length)
            {
                outputString = outputString.Substring(0, length);
            }
            else if (outputString.Length < length)
            {
                if (alignment == TextAlignment.Left)
                    while (outputString.Length < length)
                        outputString += " ";
                else if (alignment == TextAlignment.Right)
                    while (outputString.Length < length)
                        outputString = " " + outputString;
                else
                {
                    int i = 0;
                    while (outputString.Length < length)
                    {
                        if (i % 2 == 0)
                            outputString = " " + outputString;
                        else
                            outputString += " ";
                        i++;
                    }
                }
            }
            return outputString;
        }
        #endregion
    }
}

